package com.ynny.chapter06;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/demo09")
public class Demo09Servlet extends HttpServlet {


    @Override
    protected void service(HttpServletRequest request,
                           HttpServletResponse response) throws ServletException, IOException {

        //在三大作用域中 空间中 存放数据

        //请求作用域

        request.setAttribute("msg","请求作用域数据");


        //会话作用域

        request.getSession().setAttribute("msg2","会话作用域数据");

        //应用作用域

//        request.getServletContext().setAttribute("msg3","应用作用域数据");
        getServletContext().setAttribute("msg3","应用作用域数据");


    }
}
